package org.springblade.modules.repair.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Date 16:05 2024/4/7
 * @Description {
 *   救援 到达预警枚举
 * }
 * @Author lsay
 **/
@Getter
@AllArgsConstructor
public enum RescueArriveEnum {

	/**
	 * 对应数据库表里面的 arrival_warning 字段
	 */
	NORMAL(0, "无预警风险"),
	UPCOMING(1, "即将超时到达"),
	OVERTIME(2, "超时未达"),
	OVERTIME_ARRIVE(3, "超时到达"),
	OVERTIME_NOT_DISPATCH(4, "未及时调度"),
	OVERTIME_NOT_DEPART(5, "未及时出发"),
	;

	final int id;
	final String name;

	public static String getName(int id){
		RescueArriveEnum[] enums = RescueArriveEnum.values();
		for (RescueArriveEnum arriveEnum : enums) {
			if(arriveEnum.getId() == id){
				return arriveEnum.getName();
			}
		}
		return null;
	}

	public static RescueArriveEnum getEnum(int id){
		RescueArriveEnum[] enums = RescueArriveEnum.values();
		for (RescueArriveEnum arriveEnum : enums) {
			if(arriveEnum.getId() == id){
				return arriveEnum;
			}
		}
		return null;
	}
}
